package b4.controller
{
	import b4.model.ResourceLoader;
	import b4.model.TownProxy;
	import b4.model.vo.player.Role;
	import b4.model.vo.player.Town;
	import b4.view.RoleSpriteMediator;
	import b4.view.TownSceneMediator;
	
	import org.puremvc.as3.interfaces.ICommand;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;

	public class ResourceLoadedCommand extends SimpleCommand implements ICommand
	{
		override public function execute(notification:INotification):void
		{
			var type:String = notification.getType();
			switch (type)
			{
				case ResourceLoader.TYPE_TOWN:
					var town:Town = townProxy.vo.town;
					sendNotification(TownSceneMediator.LOAD_TOWN_LAYER, {townIndex:town.townIndex, layerIndex:town.layerId});
				break;
			}
		}
		
		private function get townProxy():TownProxy
		{
			return facade.retrieveProxy( TownProxy.NAME ) as TownProxy;
		}
	}
}